import { createStore } from 'vuex'
import state from './state'
import mutations from './mutations'
import getters from './getters'
import actions from './actions'

const store = createStore({
  // state mutations 最终还是返回一个对象，所以直接是对象即可
  // state () {
  //   return {
  //     count: 0
  //   }
  // },
  // mutations: {
  //   increment (state) {
  //     state.count++
  //   }
  // },
  // getters: {
  //   doneTodos (state) {
  //     return state.todos.filter(todo => todo.done)
  //   }
  // }
  // actions: {
  //   increment (context) {
  //     context.commit('increment')
  //   }
  // },
  state,
  getters,
  mutations,
  actions
})

export default store